package us.mooresr.webtroopmanager.client;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import us.mooresr.webtroopmanager.shared.Event;
import us.mooresr.webtroopmanager.shared.EventDriverSummary;
import us.mooresr.webtroopmanager.shared.EventParticipant;
import us.mooresr.webtroopmanager.shared.EventParticipantSummary;
import us.mooresr.webtroopmanager.shared.EventSummary;
import us.mooresr.webtroopmanager.shared.Person;
import us.mooresr.webtroopmanager.shared.PersonSummary;
import us.mooresr.webtroopmanager.shared.Privilege;
import us.mooresr.webtroopmanager.shared.Role;
import us.mooresr.webtroopmanager.shared.User;
import us.mooresr.webtroopmanager.shared.UserSummary;
import us.mooresr.webtroopmanager.shared.Vehicle;
import us.mooresr.webtroopmanager.shared.VehicleSummary;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("troopManager")
public interface TroopManagerService extends RemoteService {
	
	// Services related to the Person class
	public PersonSummary addPerson(Person p);
	public List<PersonSummary> getAllPeople();
	public Long deletePerson(Long key);
	public Person getPerson(Long key);
	public List<PersonSummary> getAllAdults();
	public List<PersonSummary> getPeople(Set<Long> keys);
	
	// Services related to the Event class
	public List<EventSummary> getAllEvents();
	public List<EventSummary> getFutureEvents();
	public Event getEvent(Long key);
	public EventSummary addEvent(Event e);
	public Long deleteEvent(Long key);
	public List<EventParticipantSummary> getEventParticipants(Long key);
	public Long setEventParticipants(Long key, ArrayList<EventParticipantSummary> participants);
	public List<EventDriverSummary> getEventDrivers(Long key);
	public Long setEventDrivers(Long key, ArrayList<EventDriverSummary> drivers);
	public EventParticipant getEventParticipant(Long eventId, Long personId);
	
	// Services related to the Vehicle class
	public List<VehicleSummary> getAllVehicles();
	public Vehicle getVehicle(Long key);
	public VehicleSummary addVehicle(Vehicle v);
	public Long deleteVehicle(Long key);
	
	// Services related to the Role class
	public List<Role> getAllRoles();
	public Role getRole(Long key);
	public Role addRole(Role r);
	public Long deleteRole(Long key);
	
	// Services related to the User class
	public List<UserSummary> getAllUsers();
	public User getUser(Long key);
	public UserSummary addUser(User u);
	public Long deleteUser(Long key);
	public Set<Privilege> getUserPrivileges(Long userId);
	public Set<Long> getMatchingPeople(Long userId);
	public Set<Long> getUsersVehicles(Long userId);
	
	// Miscellaneous services
	public Integer preloadData();
	public Long doLogin(String user, String pass);
	public void doLogout();
	public Boolean createLogin(String user, String pass, String realName, String emailAddress, Boolean enabled);
	public void initializeUserDatabase();
	public Boolean emailRequestToAdmin(String username, String password, String realName, String emailAddress);
	public Boolean autoApproveRequest(String username, String password, String realName, String emailAddress);
	public Boolean emailValidationToUser(String username, String password, String realName, String emailAddress, String hRef);
	public Boolean validateUser(String validationChallenge);

}